import api from './api';

export const orderService = {
  // 按日期获取订单
  getOrdersByDate: async (date) => {
    const response = await api.get(`/api/orders/date/${date}`);
    return response.data;
  },

  // 按月获取订单
  getOrdersByMonth: async (year, month) => {
    const response = await api.get(`/api/orders/month/${year}/${month}`);
    return response.data;
  },

  // 按日期范围获取订单
  getOrdersByRange: async (startDate, endDate) => {
    const response = await api.get(`/api/orders/range`, {
      params: { start: startDate, end: endDate }
    });
    return response.data;
  },

  // 获取月度排名
  getMonthlyRanking: async (year, month) => {
    const response = await api.get(`/api/orders/ranking/${year}/${month}`);
    return response.data;
  }
}; 